

import { Notification, Message, Loading } from 'element-ui'

import { Commit, Dispatch } from 'vuex';

import { get, defaultsDeep, cloneDeep } from 'lodash'

import { getProcessNotice, getReworkList, } from '@/api/process'



export interface State {

}

const state: State = {
    thirdData: [],
    noticeList: [],


};

const getters = {};

const mutations = {
    SET_NOTICE_LIST(state: any, payload: any) {
        state.noticeList = payload
    },
    SET_THIRD_DATA(state: any, payload: any) {
        state.thirdData = payload
    },


};

const actions = {





    //2-04进入产品通知单 /process/notice/all
    async GET_PROCESS_NOTICE(
        { state, commit, rootState, dispatch }: any,
        payload: any
    ) {

        let resp = await getProcessNotice(payload).catch((err: any) => {
            Notification.error(err)
        })

        if (resp) {
            let noticeList = get(resp, 'data', [])
            commit('SET_NOTICE_LIST', noticeList)
            //   Message.success('请求成功!')
            console.log(resp);
            return true
        }
    },
    //2-05返修处理查询  /rework
    async GET_REWORK_LIST(
        { state, commit, rootState, dispatch }: any,
        payload: any
    ) {

        let resp = await getReworkList(payload).catch((err: any) => {
            Notification.error(err)
        })

        if (resp) {
            let productList = get(resp, 'data', [])
            commit('SET_THIRD_DATA', productList)
            //   Message.success('请求成功!')
            console.log(resp);
            return true
        }
    },




}


export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters
};